/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package upeu.cepre.business;

import java.sql.*;
import upeu.cepre.model.Curso;
import upeu.cepre.util.DataBaseConexion;

public class CursoManager {
private Connection connection;
//    public Lis<> Report() {
//    }
//
//    public void Insert() {
//    }
//
//    public void Update() {
//    }
//
//    public void Delete() {
//    }

    /*
     * Metodos Complementarios
     */
    public Curso FindId(String IdCurso) {
        Curso to= new Curso();
        
         try {
            connection = DataBaseConexion.getConexion();
            Statement statement = connection.createStatement();
            PreparedStatement prepareestatemente = connection.prepareStatement("SELECT * From curso WHERE idCurso=?  ");
            prepareestatemente.setString(1, IdCurso);
            ResultSet rs = prepareestatemente.executeQuery();

            if (rs.next()) {

                
                to.setIdCurso(rs.getString("idCurso"));
                to.setNombre(rs.getString("nombre"));
                to.setDetalle(rs.getString("detalle"));

            }
            connection.close();
            statement.close();
            prepareestatemente.close();
            rs.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        
        return to;
    }

//    public void ObtenerId() {
//    }
}
